import request from '@/utils/request'

// 获取列表
export function listBanner(query) {
  return request({
    url: '/adverts',
    method: 'get',
    params: query
  })
}

// 新增
export function addBanner(data) {
  return request({
    url: 'adverts',
    method: 'post',
    data: data
  })
}

// 修改
export function updateBanner(data) {
  return request({
    url: `/adverts/${data.uuid}`,
    method: 'put',
    data: data
  })
}

// 删除
export function delBanner(uuid) {
  return request({
    url: `/adverts/${uuid}`,
    method: 'delete'
  })
}

// 详情
export function getBanner(uuid) {
  return request({
    url: `/adverts/${uuid}`,
    method: 'get'
  })
}

// 上传图片
export function uploadImgTencent(data) {
  return request({
    url: '/files/tencentoss/upload',
    method: 'post',
    data: data,
    headers: { 'Content-Type': 'multipart/form-data' },
  })
}
